package cn.historia.test.service;

import cn.historia.domain.req.ShopCartReq;
import cn.historia.domain.res.PayOrderRes;
import cn.historia.service.IOrderService;
import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

/**
 * @package: cn.historia.test.service
 * @className: OrderServiceTest
 * @author: 云溪
 * @description:
 * @date: 2025/7/6 16:37
 * @version: 1.0
 */
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class OrderServiceTest {

    @Resource
    private IOrderService orderService;

    @Test
    public void test() throws Exception {
        ShopCartReq shopCartReq = ShopCartReq.builder()
                .userId("historia")
                .productId("10001")
                .build();
        PayOrderRes payOrderRes = orderService.createOrder(shopCartReq);
        log.info("请求参数：{}", JSON.toJSONString(shopCartReq));
        log.info("测试结果：{}", JSON.toJSONString(payOrderRes));
    }

}
